Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
react-base16-styling
Advanced tools
React styling with base16 color scheme support
Inspired by react-themeable, this utility provides flexible theming for your component with base16 theme support.
yarn add react-base16-styling
import { createStyling } from 'react-base16-styling';
import base16Themes from './base16Themes';
function getStylingFromBase16(base16Theme) {
return {
myComponent: {
backgroundColor: base16Theme.base00,
},
myComponentToggleColor({ style, className }, clickCount) {
return {
style: {
...style,
backgroundColor: clickCount % 2 ? 'red' : 'blue',
},
};
},
};
}
const createStylingFromTheme = createStyling(getStylingFromBase16, {
defaultBase16: base16Themes.solarized,
base16Themes,
});
class MyComponent extends Component {
state = { clickCount: 0 };
render() {
const { theme } = this.props;
const { clickCount } = this.state;
const styling = createStylingFromTheme(theme);
return (
<div {...styling('myComponent')}>
<a onClick={() => this.setState({ clickCount: clickCount + 1 })}>
Click Me
</a>
<div {...styling('myComponentToggleColor', clickCount)}>
{clickCount}
</div>
</div>
);
}
}
createStyling
function(getStylingFromBase16, defaultStylingOptions, themeOrStyling)
Argument | Signature | Description |
---|---|---|
getStylingFromBase16 | function(base16Theme) | creates object with default stylings for your component, using provided base16 theme. |
defaultStylingOptions | { defaultBase16, base16Themes } | optional parameters, allow to set default base16 theme and additional base16 themes for component. |
themeOrStyling | string or object | base16 theme name, base16 theme object or styling object. Theme name can have a modifier: "themeName:inverted" to invert theme colors (see [[#invertTheme]]) |
Styling object values could be: - objects (treated as style definitions) - strings (class names) - functions (they may be provided with additional parameters and should return object { style, className })
getBase16Theme
function(themeOrStyling, base16Themes)
Helper method that returns base16
theme object if themeOrStyling
is base16
theme name or theme object.
invertBase16Theme
function(base16Theme)
Helper method that inverts base16
theme colors, creating light theme out of dark one or vice versa.
invertTheme
function(theme)
Helper method that inverts a theme or styling object to be passed into the themeOrStyling
parameter of createStyling.
FAQs
React styling with base16 color scheme support
The npm package react-base16-styling receives a total of 868,549 weekly downloads. As such, react-base16-styling popularity was classified as popular.
We found that react-base16-styling demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.